<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>HttpDoc UI</title>
    <link rel="stylesheet" href="./css/bootstrap-3.3.7.min.css">
    <link rel="stylesheet" href="./css/httpdoc-1.0.0.css">
    <script src="./js/autosize-4.0.2.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-default" role="navigation" style="border-radius: 0; border-width: 0 0 1px 0; margin: 0;">
    <div class="container">
        <div class="col-md-2">
            <div class="navbar-header">
                <a class="navbar-brand" href="https://github.com/core-lib/httpdoc" target="_blank">
                    HttpDoc UI
                    <span class="badge">v1.6.4</span>
                </a>
            </div>
        </div>
        <div class="col-md-8">
            <div class="navbar-btn">
                <div class="input-group">
                    <input id="httpdoc-url" type="text" class="form-control">
                    <span class="input-group-btn">
                        <button class="btn btn-success" onclick="httpdoc.explore();">Go!</button>
                    </span>
                </div>
            </div>
        </div>
        <div class="col-md-2">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#" data-toggle="modal" data-target="#httpdoc-config">Settings</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        SDK <b class="caret"></b>
                    </a>
                    <ul id="httpdoc-sdks" class="dropdown-menu">

                    </ul>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div id="httpdoc-head" class="row-fluid">

</div>
<div id="httpdoc-body" class="row-fluid" style="display: none;">
    <div class="container">
        <div class="col-md-2">
            <ul id="httpdoc-tags" class="nav nav-stacked">

            </ul>
        </div>
        <div class="col-md-10">
            <div id="httpdoc-controllers">

            </div>
            <div class="panel border-less">
                <div class="panel-heading border-less" data-toggle="collapse" href="#panel-models" style="cursor: pointer;">
                    <span class="panel-title"><b>Models</b></span>
                    <span class="glyphicon glyphicon-chevron-right"></span>
                </div>
                <div id="panel-models" class="panel-collapse collapse">
                    <div id="httpdoc-schemas" class="panel-body">

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="httpdoc-foot" class="row-fluid">

</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="httpdoc-config" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Settings</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-danger pull-left" onclick="httpdoc.clearSetting(this);">Clear</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-info" onclick="httpdoc.mergeSetting(this);">OK</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="httpdoc-loading" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="false" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" align="center">
                <h2>Loading ...</h2>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>

<script id="tpl-httpdoc-introduction" type="text/html">
    <div class="jumbotron" style="background-color: #f8f8f8; border-bottom: 1px solid #e7e7e7;">
        <div class="container">
            <div class="col-md-8 col-md-offset-2">
                <h2>{{#httpdoc}}{{.}}{{/httpdoc}}{{^httpdoc}}HttpDoc{{/httpdoc}} <label class="badge">{{#version}}{{.}}{{/version}}{{^version}}1.0.0{{/version}}</label></h2>
                <a href="{{url}}" target="_blank">{{url}}</a>
                <br/>
                {{#description}}
                <h5 class="text-muted">{{{description}}}</h5>
                {{/description}}
                <p><a href="https://github.com/core-lib/httpdoc" target="_blank">Learn more about HttpDoc</a></p>
            </div>
        </div>
    </div>
</script>

<script id="tpl-httpdoc-error" type="text/html">
    <div class="jumbotron" style="background-color: #f8f8f8; border-bottom: 1px solid #e7e7e7;">
        <div class="container">
            <div class="col-md-8 col-md-offset-2">
                <h2>{{code}}&nbsp{{message}}</h2>
                <a href="{{url}}" target="_blank">{{url}}</a>
                <br/>
                {{#body}}
                <pre style="max-height: 240px;">{{body}}</pre>
                {{/body}}
                <p><a href="https://github.com/core-lib/httpdoc" target="_blank">Learn more about HttpDoc</a></p>
            </div>
        </div>
    </div>
</script>

<script id="tpl-httpdoc-setting" type="text/html">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#httpdoc-setting-basic" data-toggle="tab">Basic</a></li>
        <li><a href="#httpdoc-setting-schema" data-toggle="tab">Schema</a></li>
        <li><a href="#httpdoc-setting-xhr" data-toggle="tab">XMLHttpRequest</a></li>
        <li><a href="#httpdoc-setting-query" data-toggle="tab">Query</a></li>
        <li><a href="#httpdoc-setting-header" data-toggle="tab">Header</a></li>
        <li><a href="#httpdoc-setting-cookie" data-toggle="tab">Cookie</a></li>
    </ul>
    <div class="tab-content">
        <div class="tab-pane fade in active" id="httpdoc-setting-basic">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="70%"></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>protocol</td>
                    <td><input class="form-control" name="protocol" value="{{protocol}}" placeholder="http or https"/></td>
                </tr>
                <tr>
                    <td>hostname</td>
                    <td><input class="form-control" name="hostname" value="{{hostname}}" placeholder="ip address or domain name"/></td>
                </tr>
                <tr>
                    <td>port</td>
                    <td><input class="form-control" name="port" value="{{port}}" placeholder="port number or zero"/></td>
                </tr>
                <tr>
                    <td>context</td>
                    <td><input class="form-control" name="context" value="{{context}}" placeholder="context path"/></td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="tab-pane fade" id="httpdoc-setting-schema">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="70%"></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>indent</td>
                    <td><input class="form-control" name="indent" value="{{indent}}" placeholder="line indent string"/></td>
                </tr>
                <tr>
                    <td>max depth</td>
                    <td><input class="form-control" name="maxDepth" value="{{maxDepth}}" placeholder="max depth when recursion"/></td>
                </tr>
                <tr>
                    <td>show description</td>
                    <td><input class="form-control" name="showDescription" value="{{showDescription}}" placeholder="true or false"/></td>
                </tr>
                <tr>
                    <td>default format</td>
                    <td><input class="form-control" name="defaultFormat" value="{{defaultFormat}}" placeholder="normal | table | grid"/></td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="tab-pane fade" id="httpdoc-setting-xhr">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="70%"></th>
                </tr>
                </thead>
                <tbody>
                <tr>
                    <td>username</td>
                    <td><input class="form-control" name="username" value="{{username}}" placeholder="username"/></td>
                </tr>
                <tr>
                    <td>password</td>
                    <td><input class="form-control" name="password" value="{{password}}" placeholder="password"/></td>
                </tr>
                <tr>
                    <td>async</td>
                    <td><input class="form-control" name="async" value="{{async}}" placeholder="true or false"/></td>
                </tr>
                <tr>
                    <td>timeout</td>
                    <td><input class="form-control" name="timeout" value="{{timeout}}" placeholder="timeout in milliseconds"/></td>
                </tr>
                <tr>
                    <td>withCredentials</td>
                    <td><input class="form-control" name="withCredentials" value="{{withCredentials}}" placeholder="true or false"/></td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="tab-pane fade" id="httpdoc-setting-query">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="60%"></th>
                    <th width="10%"></th>
                </tr>
                </thead>
                <tbody>
                {{#queries}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key" value="{{key}}"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value" value="{{value}}"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/queries}}
                {{^queries}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/queries}}
                <tr>
                    <td colspan="3">
                        <button class="btn btn-success" onclick="httpdoc.addSettingRow(this);">
                            <span class="glyphicon glyphicon-plus"> Add</span>
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="tab-pane fade" id="httpdoc-setting-header">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="60%"></th>
                    <th width="10%"></th>
                </tr>
                </thead>
                <tbody>
                {{#headers}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key" value="{{key}}"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value" value="{{value}}"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/headers}}
                {{^headers}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/headers}}
                <tr>
                    <td colspan="3">
                        <button class="btn btn-success" onclick="httpdoc.addSettingRow(this);">
                            <span class="glyphicon glyphicon-plus"> Add</span>
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="tab-pane fade" id="httpdoc-setting-cookie">
            <table class="table">
                <thead>
                <tr>
                    <th width="30%"></th>
                    <th width="60%"></th>
                    <th width="10%"></th>
                </tr>
                </thead>
                <tbody>
                {{#cookies}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key" value="{{key}}"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value" value="{{value}}"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/cookies}}
                {{^cookies}}
                <tr>
                    <td><input class="form-control" name="setting-key" placeholder="Setting Key"/></td>
                    <td><input class="form-control" name="setting-value" placeholder="Setting Value"/></td>
                    <td>
                        <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                            <span class="glyphicon glyphicon-remove"></span>
                        </button>
                    </td>
                </tr>
                {{/cookies}}
                <tr>
                    <td colspan="3">
                        <button class="btn btn-success" onclick="httpdoc.addSettingRow(this);">
                            <span class="glyphicon glyphicon-plus"> Add</span>
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</script>

<script id="tpl-httpdoc-setting-row" type="text/html">
    <tr>
        <td><input class="form-control" name="setting-key" placeholder="Setting Key"/></td>
        <td><input class="form-control" name="setting-value" placeholder="Setting Value"/></td>
        <td>
            <button class="btn btn-danger" onclick="httpdoc.delSettingRow(this);">
                <span class="glyphicon glyphicon-remove"></span>
            </button>
        </td>
    </tr>
</script>

<script id="tpl-httpdoc-modules" type="text/html">
    {{#.}}
    <li title="{{.}}"><a href="javascript: httpdoc.show('{{.}}');" class="text-nowrap" style="overflow: hidden;"><b>{{.}}</b></a></li>
    {{/.}}
</script>

<script id="tpl-httpdoc-models" type="text/html">
    {{#.}}
    <div class="panel border-less">
        <div class="panel-heading border-less" data-toggle="collapse" href="#httpdoc-schemas-{{name}}" style="cursor: pointer;">
            <span class="panel-title"><b>{{name}}</b></span>
            <span class="glyphicon glyphicon-chevron-right"></span>
            <span class="text-muted">{{summary}} {{#deprecated}}<label class="badge tooltip-holder" data-toggle="tooltip" data-html="true" title='{{{.}}}'>deprecated</label>{{/deprecated}}</span>
        </div>
        <div id="httpdoc-schemas-{{name}}" class="panel-collapse collapse">
            <div class="panel-body">
                {{#description}}
                <h5 class="text-muted"><b>——</b>{{{description}}}</h5>
                {{/description}}
                <textarea class="form-control autosize textarea-model" readonly>{{value}}</textarea>
            </div>
        </div>
    </div>
    {{/.}}
</script>

<script id="tpl-httpdoc-apis" type="text/html">
    {{#.}}
    <div id="controller-{{id}}">
        <div class="page-header">
            <h1>
                <b>{{name}}</b>
                <small>{{summary}} {{#deprecated}}<label class="badge tooltip-holder" data-toggle="tooltip" data-html="true" title='{{{.}}}'>deprecated</label>{{/deprecated}}</small>
            </h1>
        </div>
        <h5 class="text-muted">{{{description}}}</h5>
        {{#operations}}
        <div id="operation-{{id}}" class="panel panel-{{method}}">
            <div class="panel-heading" data-toggle="collapse" href="#httpdoc-{{id}}" style="cursor: pointer;">
                <span class="panel-title">
                    <label class="method method-{{method}}" style="cursor: pointer;">{{method}}</label>
                    <span class="path path-{{method}}"><b>{{path}}</b> {{#deprecated}}<label class="badge tooltip-holder" data-toggle="tooltip" data-html="true" title='{{{.}}}'>deprecated</label>{{/deprecated}}</span>
                </span>
                <span class="httpdoc-icon glyphicon glyphicon-chevron-right pull-right path path-{{method}}"></span>
                <span class="path path-{{method}} pull-right">&nbsp;&nbsp;{{summary}}&nbsp;&nbsp;</span>
            </div>
            <div id="httpdoc-{{id}}" class="panel-collapse collapse">
                <div class="panel-body">
                    <h5 class="text-muted">{{{description}}}</h5>
                    <div class="row-fluid">
                        <table class="table">
                            <thead>
                            <tr>
                                <td width="25%"></td>
                                <td width="75%"></td>
                            </tr>
                            </thead>
                            <tbody>
                            {{#parameters}}
                            <tr>
                                <td>
                                    <h5>{{name}} <span class="badge">{{scope}}</span></h5>
                                    <p><b>{{type}}</b></p>
                                    <h5 class="text-muted">{{{description}}}</h5>
                                </td>
                                <td>
                                    <div class="json-editor-holder"
                                         x-id="{{id}}"
                                         x-name="{{name}}"
                                         x-scope="{{scope}}"
                                         x-type="{{type}}"
                                         x-path="{{path}}"
                                         x-description="{{description}}"
                                         x-style="{{style}}"
                                    ></div>
                                </td>
                            </tr>
                            {{/parameters}}
                            {{#consumes.length}}
                            <tr>
                                <td>
                                    <h5>Content-Type <span class="badge">header</span></h5>
                                    <p><b>String</b></p>
                                    <h5 class="text-muted">Request data format</h5>
                                </td>
                                <td>
                                    <div class="row">
                                        <div class="col-md-4">
                                            <select class="form-control x-param"
                                                    x-name="Content-Type"
                                                    x-scope="header"
                                                    x-type="String"
                                                    onchange="httpdoc.onConsumeChanged(this.value, '{{id}}');"
                                            >
                                                {{#consumes}}
                                                <option value='{{.}}'>{{.}}</option>
                                                {{/consumes}}
                                            </select>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            {{/consumes.length}}
                            {{#produces.length}}
                            <tr>
                                <td>
                                    <h5>Accept <span class="badge">header</span></h5>
                                    <p><b>String</b></p>
                                    <h5 class="text-muted">Response data format</h5>
                                </td>
                                <td>
                                    <div class="row">
                                        <div class="col-md-4">
                                            <select class="form-control x-param"
                                                    x-name="Accept"
                                                    x-scope="header"
                                                    x-type="String"
                                                    onchange="httpdoc.onProduceChanged(this.value, '{{id}}');"
                                            >
                                                {{#produces}}
                                                <option value='{{.}}'>{{.}}</option>
                                                {{/produces}}
                                            </select>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            {{/produces.length}}
                            </tbody>
                        </table>
                        <div class="row-fluid">
                            <div class="row-md-12">
                                <button type="button"
                                        class="btn button button-{{method}}"
                                        onclick="httpdoc.submit(this);"
                                        x-method="{{method}}"
                                        x-path="{{path}}"
                                        x-operation="{{id}}"
                                >
                                    <b>Try it out</b>
                                </button>
                            </div>
                            <table class="table">
                                <thead>
                                <tr>
                                    <td width="25%"></td>
                                    <td width="75%"></td>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="httpdoc-curl" style="display: none;">
                                    <td>
                                        <h5>curl</h5>
                                        <p></p>
                                        <h5 class="text-muted"></h5>
                                    </td>
                                    <td><textarea class="form-control autosize textarea-model" readonly></textarea></td>
                                </tr>
                                <tr class="httpdoc-header" style="display: none;">
                                    <td>
                                        <h5>Response header</h5>
                                        <p></p>
                                        <h5 class="text-muted"></h5>
                                    </td>
                                    <td><textarea class="form-control autosize textarea-model" readonly></textarea></td>
                                </tr>
                                <tr class="httpdoc-result" style="display: none;">
                                    <td>
                                        <h5>Response body <span class="badge">body</span></h5>
                                        <p><b>{{result.type}}</b></p>
                                        <h5 class="text-muted">{{result.description}}</h5>
                                    </td>
                                    <td><textarea class="form-control autosize textarea-model" readonly x-type="{{result.type}}"></textarea></td>
                                </tr>
                                <tr class="httpdoc-example">
                                    <td>
                                        <h5>Response example <span class="badge">body</span></h5>
                                        <p><b>{{result.type}}</b></p>
                                        <h5 class="text-muted">{{result.description}}</h5>
                                    </td>
                                    <td><textarea class="form-control autosize textarea-model" readonly x-type="{{result.type}}">{{result.value}}</textarea></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {{/operations}}
    </div>
    {{/.}}
</script>

<script id="tpl-httpdoc-sdk" type="text/html">
    {{#.}}
    <li><a href="javascript: httpdoc.download('{{framework}}');">{{framework}} - {{platform}}</a></li>
    {{/.}}
    {{^.}}
    <li><a href="https://github.com/core-lib/httpdoc">no sdks detected</a></li>
    {{/.}}
</script>

<script src="./js/jquery-2.1.1.min.js"></script>
<script src="./js/mustache.min-3.0.0.js"></script>
<script src="./js/bootstrap-3.3.7.min.js"></script>
<script src="./js/autosize-4.0.2.js"></script>
<script src="./js/obj-tree-1.0.0.js"></script>
<script src="./js/jkl-dumper-1.0.0.js"></script>
<script src="./js/json-editor-v0.7.28.js"></script>
<script src="./js/httpdoc-1.0.0.js"></script>
</html>